// 该文件专门用于创建整个应用的路由器
// 引入VueRouter
import VueRouter from 'vue-router'
// 引入组件
import About from "../pages/About"
import Home from "../pages/Home"
import News from "../pages/News"
import Message from "../pages/Message"
import Details from "../pages/Details"

// 创建一个路由器
const router = new VueRouter({
  routes: [
    { 
      name: "guanyu",
      path:'/about',
      component: About
    },
    {
      path:'/home',
      component: Home,
      children: [           // 通过children配置子级路由
        {
          path: 'news',     // 此处一定不要写， /news
          component: News
        },
        {
          path: 'message',  // 此处一定不要写， /message
          component: Message,
          children: [
            {
              name: "xiangqing",  // 给路由命名
              path: "details/:id/:title",
              component: Details
            }
          ]
        }
      ]
    }
  ]
})

export default router